<template>
  <div>
    <p>第五题</p>
    <hr>
    <div>
      <p :style="{backgroundColor:color}">随机背景颜色</p>

      <button @click="btn">点击更换颜色</button>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      num1: '',
      num2: '',
      num3: '',
      color: ''
    }
  },
  methods: {
    btn () {
      this.num1 = Math.floor(Math.random() * 256)
      this.num2 = Math.floor(Math.random() * 256)
      this.num3 = Math.floor(Math.random() * 256)
      this.color = `rgb(${this.num1},${this.num2},${this.num3})`
    }
  }
}
</script>

<style>
</style>
